home *** CD-ROM | disk | FTP | other *** search
- { ---------------------------------------
- WORDS returns the number of words in S.
- --------------------------------------- }
- Function Words ( S : AnyString ) : Integer;
- var
- NumWords, CurrentAddress, Len
- : integer;
-
- begin
- S := strip(S,' ');
- Len := Length(S);
- if Len = 0 then
- Words := 0
- else
- begin
- NumWords := 1;
- CurrentAddress := 1;
- for CurrentAddress := 1 to Len do
- if S[CurrentAddress] = #32 then
- NumWords := NumWords + 1;
- Words := NumWords;
- end;
- end { Words };